package com.zmq.pic.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;

/**
 * 用户人物关系映射 entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "pic_user_figure", uniqueConstraints = { @UniqueConstraint(columnNames = {
		"USER_ID", "FIGURE_ID" }) })
public class PicUserFigure implements java.io.Serializable {

	private static final long serialVersionUID = -9088067461240860382L;
	// Fields

	private Long id;
	private PicUser picUser;
	private PicFigure picFigure;

	// Constructors

	/** default constructor */
	public PicUserFigure() {
	}

	/** full constructor */
	public PicUserFigure(PicUser picUser, PicFigure picFigure) {
		this.picUser = picUser;
		this.picFigure = picFigure;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ID", nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USER_ID", unique = true)
	public PicUser getPicUser() {
		return this.picUser;
	}

	public void setPicUser(PicUser picUser) {
		this.picUser = picUser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FIGURE_ID", unique = true)
	public PicFigure getPicFigure() {
		return this.picFigure;
	}

	public void setPicFigure(PicFigure picFigure) {
		this.picFigure = picFigure;
	}

	@Override
	public String toString() {
		return "PicUserFigure [id=" + id + ", picFigure=" + picFigure
				+ ", picUser=" + picUser + "]";
	}

}